package com.dance.java8.day01.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * 重复注解与类型注解
 */
public class TestAnnotation {

    public static void main(String[] args) throws NoSuchMethodException {
        Class<TestAnnotation> testAnnotationClass = TestAnnotation.class;
        Method show = testAnnotationClass.getMethod("show",String.class);
        Arrays.stream(show.getAnnotationsByType(MyAnnotation.class)).forEach(System.out::println);
        Annotation[][] parameterAnnotations = show.getParameterAnnotations();
        Arrays.stream(parameterAnnotations).forEach(x-> Arrays.stream(x).forEach(System.out::println));
    }

    @MyAnnotation("flower")
    @MyAnnotation("dance")
    public void show(@MyAnnotation("string") String s){

    }

}
